@extends('Admin.layouts.common')

@section('content')
    <div class="container myContainer">

        @if(count($errors))
            <div class="alert alert-danger">
                <ul>
                    @foreach($errors->all() as $err)
                        <li>{{ $err }}</li>
                    @endforeach
                </ul>
            </div>
        @endif
        

        <div class="section_body">
            <div id="wrapper">
                <div id="container">
                    <!--头部，相册选择和格式选择-->
                    <div id="uploader">
                        <div class="queueList">
                            <div id="dndArea" class="placeholder">
                                <div id="filePicker"></div>
                                <p>上传一张图片</p>
                            </div>
                        </div>
                        <div class="statusBar" style="display:none;">
                            <div class="progress">
                                <span class="text">0%</span>
                                <span class="percentage"></span>
                            </div><div class="info"></div>
                            <div class="btns">
                                <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <em style="display:none" id="upload_button">上传</em>
        </div>

        <form method="post">
            {{ csrf_field() }}
            <div class="form-group">
                <label class="control-label">IMG</label>
                <?php if(!empty($data->img)):?>
                    <img src="{{img($data->img)}}">
                <?php endif;?>
            </div>
            <div class="form-group required">
                <label class="control-label">标题</label>
                <input name="title" type="text" class="form-control" value="{{$data->title}}">
            </div>
            <div class="form-group required">
                <label class="control-label">链接地址</label>
                <input name="href" type="text" class="form-control" value="{{$data->href}}">
            </div>
            <div class="form-group required">
                <label class="control-label">排序</label>
                <input name="pos" type="text" placeholder="值越大越靠前" class="form-control" value="{{$data->pos}}">
            </div>

        
            <div class="form-group">
                <input id="goods_img" type="hidden" name="img" value="" />
                <button class="btn btn-primary btn-block" type="submit">保存</button>
            </div>
        </form>
    </div>
@endsection


@section('foot')
    <script type="text/javascript" src="/libs/webupload/dist/webuploader.js?v=<?=config('version')?>"></script>
    <script type="text/javascript" src="/libs/webupload/uploadone.js?v=<?=config('version')?>"></script>
    <link rel="stylesheet" type="text/css" href="/libs/webupload/style.css?v=<?=config('version')?>" />
    <link rel="stylesheet" type="text/css" href="/libs/webupload/css/webuploader.css?v=<?=config('version')?>" />
@endsection
